home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Griffith 0.9.8 / griffith-0.9.8-win32.exe / {app} / lib / plugins / movie / PluginMovieCineMovies.py < prev    next >
Text File  |  2008-11-17  |  5KB  |  122 lines

  1. # -*- coding: UTF-8 -*-
  2.  
  3. __revision__ = '$Id: PluginMovieCineMovies.py 1040 2008-11-15 21:13:49Z mikej06 $'
  4.  
  5. # Copyright (c) 2005-2007 Vasco Nunes, Piotr O┼╝arowski
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU Library General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  20.  
  21. # You may use and distribute this software under the terms of the
  22. # GNU General Public License, version 2 or later
  23.  
  24. import gutils
  25. import movie,string
  26.  
  27. plugin_name = "Cinemovies"
  28. plugin_description = "Cinemovies"
  29. plugin_url = "www.cinemovies.fr"
  30. plugin_language = _("French")
  31. plugin_author = "Vasco Nunes"
  32. plugin_author_email="<vasco.m.nunes@gmail.com>"
  33. plugin_version = "0.2"
  34.  
  35. class Plugin(movie.Movie):
  36.     def __init__(self, id):
  37.         self.encode='iso-8859-1'
  38.         self.movie_id = id
  39.         self.url = "http://www.cinemovies.fr/fiche_film.php?IDfilm=" + str(self.movie_id)
  40.  
  41.     def get_image(self):
  42.         self.image_url = "http://www.cinemovies.fr/images/data/films/Pfilm"
  43.         self.image_url = self.image_url + string.strip(gutils.trim(self.page,"data/films/Pfilm",".jpg")) + ".jpg"
  44.  
  45.     def get_o_title(self):
  46.         self.o_title = string.capwords(gutils.trim(self.page,"Titre original</b></td>","</td>"))
  47.  
  48.     def get_title(self):
  49.         self.title = string.capwords(gutils.trim(self.page,"<TR><TD class=\"arial12blacknews\">"," :</TD></TR><TR><TD"))
  50.  
  51.     def get_director(self):
  52.         self.director = string.strip(gutils.trim(self.page," par:</b></td>","</a>"))
  53.  
  54.     def get_plot(self):
  55.         self.plot = gutils.trim(self.page,"L'histoire</font></td>","</p><br>")
  56.  
  57.     def get_year(self):
  58.         self.year = gutils.trim(self.page,"<B>Ano:</B> <FONT SIze=-1>","</FONT>")
  59.  
  60.     def get_runtime(self):
  61.         self.runtime = gutils.trim(self.page,"height=\"12\">Dur├⌐e: ","</td>")
  62.  
  63.     def get_genre(self):
  64.         self.genre = gutils.trim(self.page,"Genre: ","</b></a>")
  65.  
  66.     def get_cast(self):
  67.         self.cast = ""
  68.         self.cast = gutils.trim(self.page,"<b>Avec:</b>","</tr>")
  69.  
  70.     def get_classification(self):
  71.         self.classification = gutils.trim(self.page,"<B>Idade:</B> <FONT SIze=-1>","</FONT>")
  72.  
  73.     def get_studio(self):
  74.         self.studio = string.strip(gutils.trim(self.page," Studio/Distributeur</b></td>","</td>"))
  75.  
  76.     def get_o_site(self):
  77.         self.o_site = gutils.trim(self.page,"<A HREF='", "' TARGET=_blank><IMG SRC='/imagens/bf_siteoficial.gif'")
  78.  
  79.     def get_site(self):
  80.         self.site = gutils.trim(self.page,"/imagens/bf_siteoficial.gif' WIDTH=89 HEIGHT=18 BORDER=0 ALT=''>", "' TARGET=_blank><IMG SRC='/imagens/bf_imdb.gif'")
  81.         self.site = gutils.after(self.site,"<A HREF='")
  82.         self.site = string.replace(self.site,"'","")
  83.  
  84.     def get_trailer(self):
  85.         self.trailer = gutils.trim(self.page,"/imagens/bf_imdb.gif' WIDTH=89 HEIGHT=18 BORDER=0 ALT=''>", "' TARGET=_blank><IMG SRC='/imagens/bf_trailer.gif'")
  86.         self.trailer = gutils.after(self.trailer,"<A HREF='")
  87.  
  88.     def get_country(self):
  89.         self.country = string.strip(gutils.trim(self.page," Pays</b></td>","</td>"))
  90.  
  91.     def get_rating(self):
  92.         tmp_rating = gutils.trim(self.page,"<td width=\"100%\" class=\"arial12blacknews\"><p align=\"center\"><font size=\"5\">","/5</font></td>")
  93.         if tmp_rating != "":
  94.             self.rating = str(float(tmp_rating)*2)
  95.         else:
  96.             self.rating = ""
  97.  
  98. class SearchPlugin(movie.SearchMovie):
  99.     def __init__(self):
  100.         self.encode='iso-8859-1'
  101.         self.original_url_search    = "http://www.cinemovies.fr/resultat_recherche.php?cherche="
  102.         self.translated_url_search    = "http://www.cinemovies.fr/resultat_recherche.php?cherche="
  103.  
  104.     def search(self,parent_window):
  105.         self.open_search(parent_window)
  106.         self.sub_search()
  107.         return self.page
  108.  
  109.     def sub_search(self):
  110.         self.page = gutils.trim(self.page,"height=\"6\">Films</td>", "height=\"6\">News</td>")
  111.  
  112.     def get_searches(self):
  113.         elements = string.split(self.page,"</tr>  <tr>")
  114.         self.number_results = elements[-1]
  115.  
  116.         if (elements[0]<>''):
  117.             for element in elements:
  118.                 self.ids.append(gutils.trim(element,"?IDfilm=","\" class=\"arial"))
  119.                 self.titles.append(gutils.convert_entities(gutils.strip_tags(gutils.trim(element,"12black3\">","</font><br>"))))
  120.         else:
  121.             self.number_results = 0
  122.